function filter(arr, callback) {
    result = []
    for (var i = 0; i < arr.length; i++) {
        let res = callback(arr[i])
        if (res) {
            result.push(arr[i])
        }
    }
    return result
}